home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / Bonus / Plasmatech / ptscp_eval.exe / %MAINDIR% / EvalC4 / UPTShellUtils.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-08-31  |  12.4 KB  |  327 lines

  1. // Borland C++ Builder
  2. // Copyright (c) 1995, 1999 by Borland International
  3. // All rights reserved
  4.  
  5. // (DO NOT EDIT: machine generated header) 'UPTShellUtils.pas' rev: 4.00
  6.  
  7. #ifndef UPTShellUtilsHPP
  8. #define UPTShellUtilsHPP
  9.  
  10. #pragma delphiheader begin
  11. #pragma option push -w-
  12. #include <UPTShell95.hpp>    // Pascal unit
  13. #include <ComObj.hpp>    // Pascal unit
  14. #include <Classes.hpp>    // Pascal unit
  15. #include <Forms.hpp>    // Pascal unit
  16. #include <Messages.hpp>    // Pascal unit
  17. #include <OLE2.hpp>    // Pascal unit
  18. #include <Dialogs.hpp>    // Pascal unit
  19. #include <ShellAPI.hpp>    // Pascal unit
  20. #include <SysUtils.hpp>    // Pascal unit
  21. #include <Windows.hpp>    // Pascal unit
  22. #include <SysInit.hpp>    // Pascal unit
  23. #include <System.hpp>    // Pascal unit
  24.  
  25. //-- user supplied -----------------------------------------------------------
  26.  
  27. namespace Uptshellutils
  28. {
  29. //-- type declarations -------------------------------------------------------
  30. #pragma option push -b-
  31. enum TCSIDL { csidlDesktop, csidl_None1, csidlPrograms, csidlControls, csidlPrinters, csidlPersonal, 
  32.     csidlFavorites, csidlStartup, csidlRecent, csidlSendTo, csidlBitBucket, csidlStartMenu, csidl_None2, 
  33.     csidl_None3, csidl_None4, csidl_None5, csidlDesktopDirectory, csidlDrives, csidlNetwork, csidlNethood, 
  34.     csidlFonts, csidlTemplates, csidlCommonStartMenu, csidlCommonPrograms, csidlCommonStartup, csidlCommonDesktopDirectory, 
  35.     csidlAppData, csidlPrintHood, csidlNone };
  36. #pragma option pop
  37.  
  38. #pragma pack(push, 1)
  39. struct TPTModuleVersion
  40. {
  41.     
  42.     union
  43.     {
  44.         struct 
  45.         {
  46.             int _3;
  47.             int version;
  48.             
  49.         };
  50.         struct 
  51.         {
  52.             Word _1;
  53.             Word _2;
  54.             Word minor;
  55.             Word major;
  56.             
  57.         };
  58.         struct 
  59.         {
  60.             int dw1;
  61.             int dw2;
  62.             
  63.         };
  64.         struct 
  65.         {
  66.             Word w1;
  67.             Word w2;
  68.             Word w3;
  69.             Word w4;
  70.             
  71.         };
  72.         
  73.     };
  74. } ;
  75. #pragma pack(pop)
  76.  
  77. typedef TPTModuleVersion *PPTModuleVersion;
  78.  
  79. #pragma option push -b-
  80. enum TPTFriendlyNameFlags { ptfnNormal, ptfnInFolder, ptfnForParsing };
  81. #pragma option pop
  82.  
  83. #pragma option push -b-
  84. enum TPTShellIconSize { ptsizSmall, ptsizLarge };
  85. #pragma option pop
  86.  
  87. class DELPHICLASS TPTIdListArray;
  88. #pragma pack(push, 4)
  89. class PASCALIMPLEMENTATION TPTIdListArray : public System::TObject 
  90. {
  91.     typedef System::TObject inherited;
  92.     
  93. protected:
  94.     Uptshell95::TItemIDList *mPidl;
  95.     Uptshell95::TItemIDList *mLastItem;
  96.     int __fastcall GetCount(void);
  97.     Uptshell95::PItemIDList __fastcall GetItem(int idx);
  98.     
  99. public:
  100.     __fastcall TPTIdListArray(Uptshell95::PItemIDList p);
  101.     __fastcall virtual ~TPTIdListArray(void);
  102.     Uptshell95::PItemIDList __fastcall GoUp(int items);
  103.     __property int ItemCount = {read=GetCount, nodefault};
  104.     __property Uptshell95::PItemIDList Item[int idx] = {read=GetItem/*, default*/};
  105. };
  106.  
  107. #pragma pack(pop)
  108.  
  109. class DELPHICLASS TPTPidlList;
  110. #pragma pack(push, 4)
  111. class PASCALIMPLEMENTATION TPTPidlList : public System::TObject 
  112. {
  113.     typedef System::TObject inherited;
  114.     
  115. private:
  116.     Classes::TList* FList;
  117.     bool FSorted;
  118.     Uptshell95::IShellFolder* FShellFolder;
  119.     IMalloc* FMalloc;
  120.     Classes::TDuplicates FDuplicates;
  121.     Uptshell95::PItemIDList __fastcall GetPIDL(int Index);
  122.     void __fastcall SetPIDL(int Index, Uptshell95::PItemIDList PIDL);
  123.     void * __fastcall GetObject(int Index);
  124.     void __fastcall SetObject(int Index, void * aObject);
  125.     void __fastcall SetSorted(bool isSorted);
  126.     int __fastcall GetCount(void);
  127.     int __fastcall GetCapacity(void);
  128.     void __fastcall SetCapacity(int cap);
  129.     
  130. protected:
  131.     bool __fastcall BinarySearch(const Uptshell95::PItemIDList PIDL, int &Index);
  132.     bool __fastcall LinearSearch(const Uptshell95::PItemIDList PIDL, int &Index);
  133.     
  134. public:
  135.     __fastcall TPTPidlList(void);
  136.     __fastcall virtual ~TPTPidlList(void);
  137.     virtual int __fastcall Add(const Uptshell95::PItemIDList PIDL);
  138.     virtual int __fastcall AddObject(const Uptshell95::PItemIDList PIDL, System::TObject* aObject);
  139.     void __fastcall Delete(int index);
  140.     void __fastcall Clear(void);
  141.     int __fastcall IndexOf(const Uptshell95::PItemIDList PIDL);
  142.     void __fastcall Insert(int Index, Uptshell95::PItemIDList Pidl);
  143.     void __fastcall InsertObject(int Index, Uptshell95::PItemIDList Pidl, void * aObject);
  144.     void __fastcall Sort(void);
  145.     __property Uptshell95::PItemIDList PIDLs[int index] = {read=GetPIDL, write=SetPIDL/*, default*/};
  146.     __property void * Objects[int index] = {read=GetObject, write=SetObject};
  147.     __property bool Sorted = {read=FSorted, write=SetSorted, nodefault};
  148.     __property IMalloc* Malloc = {read=FMalloc, write=FMalloc};
  149.     __property int Count = {read=GetCount, nodefault};
  150.     __property Uptshell95::IShellFolder* ShellFolder = {read=FShellFolder, write=FShellFolder};
  151.     __property Classes::TDuplicates Duplicates = {read=FDuplicates, write=FDuplicates, nodefault};
  152.     __property int Capacity = {read=GetCapacity, write=SetCapacity, nodefault};
  153. };
  154.  
  155. #pragma pack(pop)
  156.  
  157. #pragma option push -b-
  158. enum TLinkDataOption { ldoUseDesc, ldoUseArgs, ldoUseIcon, ldoUseWorkDir, ldoUseHotKey, ldoUseShowCmd 
  159.     };
  160. #pragma option pop
  161.  
  162. typedef Set<TLinkDataOption, ldoUseDesc, ldoUseShowCmd>  TLinkDataOptions;
  163.  
  164. #pragma pack(push, 4)
  165. struct TLinkData
  166. {
  167.     AnsiString pathName;
  168.     TLinkDataOptions options;
  169.     AnsiString desc;
  170.     AnsiString args;
  171.     AnsiString iconPath;
  172.     int iconIndex;
  173.     AnsiString workingDir;
  174.     int showCmd;
  175.     Word hotkey;
  176.     bool noUI;
  177.     Uptshell95::TItemIDList *idList;
  178.     _WIN32_FIND_DATAA w32fd;
  179. } ;
  180. #pragma pack(pop)
  181.  
  182. typedef void __fastcall (__closure *TPTDeviceChangeEvent)(System::TObject* ASender, Messages::TMessage 
  183.     &AMessage);
  184.  
  185. class DELPHICLASS TPTDeviceChangeHandler;
  186. #pragma pack(push, 4)
  187. class PASCALIMPLEMENTATION TPTDeviceChangeHandler : public System::TObject 
  188. {
  189.     typedef System::TObject inherited;
  190.     
  191. private:
  192.     bool FActive;
  193.     HWND FWindowReceiver;
  194.     Classes::TList* FNotifyList;
  195.     
  196. protected:
  197.     void __fastcall DeleteItem(int AItemIndex);
  198.     void __fastcall WndProc(Messages::TMessage &AMessage);
  199.     void __fastcall BroadcastToList(Messages::TMessage &AMessage);
  200.     
  201. public:
  202.     __fastcall TPTDeviceChangeHandler(void);
  203.     __fastcall virtual ~TPTDeviceChangeHandler(void);
  204.     void __fastcall Add(TPTDeviceChangeEvent AToNotify);
  205.     void __fastcall Remove(TPTDeviceChangeEvent AToNotify);
  206.     __property bool Active = {read=FActive, write=FActive, nodefault};
  207. };
  208.  
  209. #pragma pack(pop)
  210.  
  211. //-- var, const, procedure ---------------------------------------------------
  212. static const int COMCTL32_VER580 = 0x50050;
  213. static const int COMCTL32_VER472 = 0x40048;
  214. static const int COMCTL32_VER471 = 0x40047;
  215. static const int COMCTL32_VER470 = 0x40046;
  216. static const int COMCTL32_VER400 = 0x40000;
  217. extern PACKAGE TPTModuleVersion COMCTL32_VER;
  218. extern PACKAGE int gFlushDriveInfoSem;
  219. #define PTSH_CMDS_DELETE "delete"
  220. #define PTSH_CMDS_PASTE "paste"
  221. #define PTSH_CMDS_CUT "cut"
  222. #define PTSH_CMDS_COPY "copy"
  223. #define PTSH_CMDS_PROPERTIES "properties"
  224. #define PTSH_CMDS_EXPLORE "explore"
  225. #define PTSH_CMDS_OPEN "open"
  226. #define PTSH_CMDS_FIND "find"
  227. #define PTSH_CMDS_LINK "link"
  228. #define PTSH_CMDS_DUN_CREATE "create"
  229. #define PTSH_CMDS_DUN_CONNECT "connect"
  230. #define PTSH_CMDID_FORMAT (char *)(0x23)
  231. static const Shortint DBT_DEVNODES_CHANGED = 0x7;
  232. static const Shortint DBT_QUERYCHANGECONFIG = 0x17;
  233. static const Shortint DBT_CONFIGCHANGED = 0x18;
  234. static const Shortint DBT_CONFIGCHANGECANCELED = 0x19;
  235. static const Shortint DBT_MONITORCHANGE = 0x1b;
  236. static const Shortint DBT_SHELLLOGGEDON = 0x20;
  237. static const Shortint DBT_CONFIGMGAPI32 = 0x22;
  238. static const Shortint DBT_VXDINITCOMPLETE = 0x23;
  239. static const Word DBT_VOLLOCKQUERYLOCK = 0x8041;
  240. static const Word DBT_VOLLOCKLOCKTAKEN = 0x8042;
  241. static const Word DBT_VOLLOCKLOCKFAILED = 0x8043;
  242. static const Word DBT_VOLLOCKQUERYUNLOCK = 0x8044;
  243. static const Word DBT_VOLLOCKLOCKRELEASED = 0x8045;
  244. static const Word DBT_VOLLOCKUNLOCKFAILED = 0x8046;
  245. static const Shortint DBT_NO_DISK_SPACE = 0x47;
  246. static const Shortint DBT_LOW_DISK_SPACE = 0x48;
  247. static const Word DBT_DEVICEARRIVAL = 0x8000;
  248. static const Word DBT_DEVICEQUERYREMOVE = 0x8001;
  249. static const Word DBT_DEVICEQUERYREMOVEFAILED = 0x8002;
  250. static const Word DBT_DEVICEREMOVEPENDING = 0x8003;
  251. static const Word DBT_DEVICEREMOVECOMPLETE = 0x8004;
  252. static const Word DBT_DEVICETYPESPECIFIC = 0x8005;
  253. static const Shortint DBT_DEVTYP_OEM = 0x0;
  254. static const Shortint DBT_DEVTYP_DEVNODE = 0x1;
  255. static const Shortint DBT_DEVTYP_VOLUME = 0x2;
  256. static const Shortint DBT_DEVTYP_PORT = 0x3;
  257. static const Shortint DBT_DEVTYP_NET = 0x4;
  258. static const Shortint DBT_DEVTYP_DEVICEINTERFACE = 0x5;
  259. static const Shortint DBT_DEVTYP_HANDLE = 0x6;
  260. extern PACKAGE bool __fastcall IsWin95(void);
  261. extern PACKAGE bool __fastcall IsOSR2OrGreater(void);
  262. extern PACKAGE bool __fastcall IsWinNT(void);
  263. extern PACKAGE bool __fastcall IsWin2000(void);
  264. extern PACKAGE bool __fastcall HasWin95Shell(void);
  265. extern PACKAGE bool __fastcall GetModuleVersion(const AnsiString aModuleName, TPTModuleVersion &aVersion
  266.     );
  267. extern PACKAGE void * __fastcall ShellMemAlloc(unsigned size);
  268. extern PACKAGE void * __fastcall ShellMemRealloc(void * p, unsigned size);
  269. extern PACKAGE void __fastcall ShellMemFree(void * p);
  270. extern PACKAGE IMalloc* __fastcall ShellIMalloc(void);
  271. extern PACKAGE unsigned __fastcall ShellGetFolderFromIdList(Uptshell95::PItemIDList p, Uptshell95::IShellFolder* 
  272.     &ish);
  273. extern PACKAGE unsigned __fastcall ShellGetIdListFromPath(const AnsiString path, Uptshell95::PItemIDList 
  274.     &p);
  275. extern PACKAGE AnsiString __fastcall ShellGetPathFromIdList(Uptshell95::PItemIDList p);
  276. extern PACKAGE AnsiString __fastcall ShellGetDisplayPathName(AnsiString aPathName);
  277. extern PACKAGE AnsiString __fastcall ShellGetSpecialFolderPath(int ahwnd, TCSIDL csidl);
  278. extern PACKAGE unsigned __fastcall ShellGetSpecialFolderIdList(int ahwnd, TCSIDL csidl, Uptshell95::PItemIDList 
  279.     &idlist);
  280. extern PACKAGE int __fastcall ShellGetIconIndex(Uptshell95::PItemIDList absIdList, unsigned uFlags);
  281.     
  282. extern PACKAGE int __fastcall ShellGetIconIndexFromPath(const AnsiString path, unsigned uFlags);
  283. extern PACKAGE int __fastcall ShellGetIconIndexFromExt(const AnsiString ext, unsigned uFlags);
  284. extern PACKAGE int __fastcall ShellGetSpecialFolderIconIndex(TCSIDL csidl, unsigned uFlags);
  285. extern PACKAGE TCSIDL __fastcall ShellFindCSIDLFromIdList(Uptshell95::PItemIDList aIdList);
  286. extern PACKAGE AnsiString __fastcall ShellGetFriendlyNameFromIdList(Uptshell95::IShellFolder* ishf, 
  287.     Uptshell95::PItemIDList pidl, TPTFriendlyNameFlags flags);
  288. extern PACKAGE unsigned __fastcall ShellGetSystemImageList(TPTShellIconSize aSize);
  289. extern PACKAGE AnsiString __fastcall StrretToString(Uptshell95::PItemIDList pidl, const Uptshell95::TStrRet 
  290.     &r);
  291. extern PACKAGE void __fastcall StrretFree(const Uptshell95::TStrRet &r);
  292. extern PACKAGE AnsiString __fastcall EnsureTrailingCharDB(const AnsiString aSource, char aTrailingChar
  293.     );
  294. extern PACKAGE int __fastcall IdListLen(Uptshell95::PItemIDList pidl);
  295. extern PACKAGE int __fastcall CompareAbsIdLists(Uptshell95::PItemIDList pidl1, Uptshell95::PItemIDList 
  296.     pidl2);
  297. extern PACKAGE Uptshell95::PItemIDList __fastcall ConcatIdLists(IMalloc* ishm, Uptshell95::PItemIDList 
  298.     aFirst, Uptshell95::PItemIDList aSecond);
  299. extern PACKAGE Uptshell95::PItemIDList __fastcall CopyIdList(IMalloc* ishm, Uptshell95::PItemIDList 
  300.     pidl);
  301. extern PACKAGE unsigned __fastcall CreateShortcut(const AnsiString linkPathName, const TLinkData &linkData
  302.     );
  303. extern PACKAGE unsigned __fastcall CreateQuickShortcut(const AnsiString linkPathName, const AnsiString 
  304.     targetPathName);
  305. extern PACKAGE unsigned __fastcall ResolveShortcut(const AnsiString linkPathName, TLinkData &linkData
  306.     , bool afWantIdList);
  307. extern PACKAGE bool __fastcall PTClsidFromFileType(AnsiString aExtension, GUID &aCLSID);
  308. extern PACKAGE void __fastcall FlushDriveInfoCache(void);
  309. extern PACKAGE void __fastcall LockFlushDriveInfoCache(void);
  310. extern PACKAGE void __fastcall UnlockFlushDriveInfoCache(void);
  311. extern PACKAGE AnsiString __fastcall FormatStrPos(AnsiString aFmtStr, const AnsiString * data, const 
  312.     int data_Size);
  313. extern PACKAGE void __fastcall ParametizeCmdLineDB(const AnsiString ins, Classes::TStrings* outs);
  314. extern PACKAGE AnsiString __fastcall TrimRightDB(AnsiString Str);
  315. extern PACKAGE void __fastcall CopyCharDB(int &APos, const AnsiString ASource, AnsiString &ADest);
  316. extern PACKAGE TPTDeviceChangeHandler* __fastcall PTDeviceChangeHandler(void);
  317.  
  318. }    /* namespace Uptshellutils */
  319. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  320. using namespace Uptshellutils;
  321. #endif
  322. #pragma option pop    // -w-
  323.  
  324. #pragma delphiheader end.
  325. //-- end unit ----------------------------------------------------------------
  326. #endif    // UPTShellUtils
  327.